home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / CALLOC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  376 b   |  20 lines

  1. /* calloc.c  p. 128 */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <alloc.h>
  5. char *buffer;
  6. main()
  7. {
  8.     buffer = (char *) calloc(100, 80);
  9.     if (buffer == NULL)
  10.     {
  11.  
  12.        printf("Allocation Failed.\n");
  13.        exit(0);
  14.  
  15.     }
  16.     printf("Buffer allocated. Enter string to store: ");
  17.     gets(buffer);
  18.     printf("\nYou entered: %s\n", buffer);
  19.  
  20. }